#define _CRT_SECURE_NO_WARNINGS

#include "sort.h"


int TestSort()
{
	//int arr[10] = { 5,8,9,6,3,4,7,2,1,0 };
	srand((unsigned)time(NULL));
	int N = 100000000;
	int sum = 0;
	for (int j = 0; j < MAX; j++)
	{
		int* arr1 = (int*)malloc(sizeof(int) * N);
		if (arr1 == NULL)
		{
			perror("malloc failed");
			return;
		}
		for (int i = 0; i < N; i++)
		{
			arr1[i] = rand();
		}
		int begin = clock();
		ShellSort(arr1, N);
		int end = clock();
		int sptime = end - begin;
		sum += sptime;
		free(arr1);
		arr1 = NULL;
	}
	return sum / MAX;
}

int main()
{
	int over = TestSort();
	printf("%dms", over);
	return 0;
}